# -*- coding: utf-8 -*-
"""
Module Description: var资源日志组件（银粮兵宝不在此类作特殊处理）
Date: 2018/8/7
Author:Sky
"""
from pyshare.const.enums.alliance import OperationType
from pyshare.const.enums.log import FieldName
from pyshare.const.enums.prince import TeachType
from pyshare.utils.game_log.log_param import LogParam
from pyshare.utils.game_log.log_utils import LogManager
from pyshare.const.enums.cross_chess import VarLogRemarkDict, CrossChessPowerLogDict, CrossChessPassCardNumLogDict
from pyshare.const.enums.cross_naadam import RoleVitCrossNadamLogDict, RolePrestigeCrossNadamLogDict, \
    RoleScoreCrossNadamLogDict, HadaCrossNadamLogDict
from common.service_config import get_action_id


class ItemLog(object):
    """
    道具日志组件(scene为道具类型:道具id)
    """
    @staticmethod
    def log_game(log_param, item_type, item_id, item_count, add_value):
        """
        记录一般道具物品
        :param log_param:
        :param item_type: 物品类型
        :param item_id: 物品id
        :param item_count: 当前物品数量
        :param add_value: 物品增量
        :return:
        """
        log_param.field_name = FieldName.Item
        log_param.scene = str(item_type) + ':' + str(item_id)

        log_param.old_val = item_count - add_value
        log_param.new_val = item_count

        LogManager.log_game(log_param)

    @staticmethod
    def log_minister_or_concubine(log_param, cfg_id, item_type, item_id):
        """
        记录获得大臣或妃子
        :param log_param:
        :param cfg_id: 大臣/妃子id
        :param item_type: 物品类型
        :param item_id: 物品id
        :return:
        """
        log_param.field_name = FieldName.Item
        if not isinstance(log_param.reserve, dict):
            log_param.reserve = {}
        log_param.reserve['CfgId'] = cfg_id
        log_param.scene = str(item_type) + ':' + str(item_id)
        LogManager.log_game(log_param)

    @staticmethod
    def log_interaction_use(log_param, receive_rid, item_type, item_id, choose_id):
        """
        记录交互道具的使用情况
        :param choose_id:
        :param receive_rid:
        :param log_param:
        :param item_type:
        :param item_id:
        :return:
        """
        log_param.field_name = FieldName.Item
        log_param.reserve['receive_rid'] = receive_rid
        log_param.reserve['choose_id'] = choose_id
        log_param.remark = '交互道具使用记录'
        log_param.scene = str(item_type) + ':' + str(item_id)
        LogManager.log_game(log_param)


class RechargeLog(object):
    """
    充值相关日志组件
    """
    class LogKey(object):
        """日志记录数据的Key标识"""
        role_info = 'role_info'  # 玩家角色信息
        product_id_set = 'product_id_set'  # 可购买项集合
        common_recharge = 'common_recharge'  # 普通充值项
        growth_plan = 'growth_plan'  # 成长计划
        cash_gift = 'cash_gift'  # 现金礼包
        unlock_recharge = 'unlock_recharge'  # 充值解锁
        power_found = 'power_found'  # 国力基金
        cash_time_limit_gift = 'cash_time_limit_gift'  # 限时现金礼包
        new_growth_plan = 'new_growth_plan'  # 新成长计划
        limit_fund = 'limit_fund'            # 限时基金
        regress_limit_gift = 'regress_limit_gift'            # 玩家回归限时礼包
        regress_cash_gift = 'regress_cash_gift'              # 玩家回归现金礼包
        anniversary_gift = 'anniversary_gift'               # 周年庆礼包
        group_purchase_gift = 'group_purchase_gift'         # 团购礼包
        festival_cash_gift = 'festival_cash_gift'           # 节日现金礼包
        activity_cash_gift = 'activity_cash_gift'  # 活动现金礼包
        optional_award_cash_gift = 'optional_award_cash_gift'  # 自选奖励现金礼包
        push_gift = 'push_gift'                             # 推送礼包
        vip_limit_gift = 'vip_limit_gift'  # vip限购礼包
        minister_fund = 'minister_fund'                     # 名臣基金

    def __init__(self, rid, server_id, scene, field_name=FieldName.Recharge, log_remark='可购买项'):
        self._rid = rid
        self._server_id = server_id
        self._scene = scene
        self._field_name = field_name

        self._log_data_dict = {}  # 日志数据
        self._can_purchase_log_remark = log_remark  # 可够买项 日志记录scene值

    def add_log_data(self, record_key, record_value):
        """
        对外暴露的日志数据唯一的添加方法；
        此方法可以省去对_log_data_dict属性添加字典数据描述符，避免类型异常；
        另外，此处可以根据LogKey添加record_key的枚举校验。

        记录值set转list是为了满足日志发送前的序列化
        """
        if isinstance(record_value, set):
            record_value = list(record_value)
        self._log_data_dict[record_key] = record_value

    def alter_log_remark(self, val_str):
        """修改日志记录remark标识的值，默认为：‘可购买项’ """
        self._can_purchase_log_remark = val_str

    def log_record(self):
        """购买项日志记录主体"""
        log_param = LogParam(self._rid, field_name=self._field_name, scene=self._scene,
                             remark=self._can_purchase_log_remark, server_id=self._server_id,
                             reserve=self._log_data_dict)
        LogManager.log_game(log_param)


class RefundLog(object):
    """
    退款相关日志组件
    """
    @staticmethod
    def log_game(log_param, order_id, role=None, refund_amount=None, old_vip_lv=None, refund_type=None,
                 old_val=None, add_val=None, costume_id=None, back_award_list=None,
                 reduce_item_list=None, palace_dict=None, dinner_dress_list=None, building_dict=None,
                 house_list=None, house_dict=None, minister_dict=None, concubine_dict=None):
        """
        记录退款相关日志
        :param log_param: 日志参数
        :param order_id: 退款订单ID
        :param role: 退款后角色数据
        :param refund_amount: 退款金额
        :param old_vip_lv: 退款前vip等级
        :param refund_type: 退款类型
        :param old_val: 原皮肤等级/原国力
        :param add_val: 皮肤等级变动/国力变动
        :param costume_id: 皮肤id
        :param back_award_list: 返还奖励列表
        :param reduce_item_list: 扣除奖励列表
        :param palace_dict: 宫殿字典
        :param dinner_dress_list: 宫殿装扮列表
        :param building_dict: 府邸字典（扣除府主）
        :param house_list: 府邸建筑列表（扣除府主）
        :param house_dict: 府邸建筑字典（扣除幕僚）
        :param minister_dict: 大臣字典（扣除大臣）
        :param concubine_dict: 妃子字典（扣除妃子）
        :return:
        """
        log_param.field_name = FieldName.Refund
        log_param.scene = order_id
        if add_val:
            log_param.old_val = old_val
            log_param.new_val = old_val + add_val
        if role:
            log_param.reserve['Role'] = role
            log_param.reserve['RefundAmount'] = refund_amount
            log_param.reserve['OldVipLv'] = old_vip_lv
            log_param.reserve['RefundType'] = refund_type
        if costume_id:
            log_param.reserve['CostumeId'] = costume_id
        if back_award_list:
            log_param.reserve['BackAwardList'] = back_award_list
        if reduce_item_list:
            log_param.reserve['ReduceItemList'] = reduce_item_list
        if dinner_dress_list:
            log_param.reserve['DinnerDressList'] = dinner_dress_list
        if palace_dict:
            log_param.reserve['PalaceDict'] = palace_dict
        if building_dict:
            log_param.reserve['BuildingDict'] = building_dict
        if house_list:
            log_param.reserve['HouseList'] = house_list
        if house_dict:
            log_param.reserve['HouseDict'] = house_dict
        if minister_dict:
            log_param.reserve['MinisterDict'] = minister_dict
        if concubine_dict:
            log_param.reserve['ConcubineDict'] = concubine_dict
        LogManager.log_game(log_param)

##########################
#   加到角色的字段上的数值
##########################


class RoleExpLog(object):
    """
    君王经验日志
    """
    @staticmethod
    def log_game(log_param, new_val):
        """
        记录君王经验
        :param log_param:
        :param new_val: 获得的经验
        :return:
        """
        log_param.field_name = FieldName.RoleExp
        log_param.old_val = 0
        log_param.new_val = new_val
        log_param.scene = '11102等'
        LogManager.log_game(log_param)


class IndicatorsLog(object):
    """
    国力涨幅日志
    """
    @staticmethod
    def log_game(log_param, old_val, new_val):
        """
        记录国力涨幅
        :param log_param:
        :param old_val: 旧国力
        :param new_val: 新国力
        :return:
        """
        log_param.field_name = FieldName.Indicators
        log_param.old_val = old_val
        log_param.new_val = new_val

        LogManager.log_game(log_param)


class ActivenessLog(object):
    """
    活跃度日志
    """
    @staticmethod
    def log_game(log_param, item_type, item_id, item_count, add_value):
        """
        记录活跃度
        :param log_param:
        :param item_type: 物品类型
        :param item_id: 物品id
        :param item_count: 当前物品数量
        :param add_value: 获得的活跃度
        :return:
        """
        log_param.field_name = FieldName.Activeness
        log_param.scene = str(item_type) + ':' + str(item_id)
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count

        LogManager.log_game(log_param)


class ForeignPointLog(object):
    """
    外交点日志
    """
    @staticmethod
    def log_game(log_param, foreign_point, add_value, vassal_state_id=None):
        """
        外交点
        :param log_param:
        :param foreign_point: 外交点
        :param add_value: 获得外交点
        :param vassal_state_id: 藩属国id（升级藩属国才有）
        :return:
        """
        log_param.field_name = FieldName.ForeignPoint
        log_param.old_val = foreign_point - add_value
        log_param.new_val = foreign_point

        reserve = log_param.reserve
        if vassal_state_id:
            reserve['VassalStateId'] = vassal_state_id
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class HuntScoreLog(object):
    """
    围猎积分日志
    """
    @staticmethod
    def log_game(log_param, hunt_score, add_value):
        """
        围猎积分
        :param log_param:
        :param hunt_score: 围猎积分
        :param add_value: 获得围猎积分
        :return:
        """
        log_param.field_name = FieldName.HuntScore
        log_param.old_val = hunt_score - add_value
        log_param.new_val = hunt_score

        LogManager.log_game(log_param)


class ImperialGardenScoreLog(object):
    """
    御花园积分日志
    """
    @staticmethod
    def log_game(log_param, imperial_garden_score, add_value):
        """
        御花园积分
        :param log_param:
        :param imperial_garden_score: 御花园积分
        :param add_value: 获得的御花园积分
        :return:
        """
        log_param.field_name = FieldName.ImperialGardenScore
        log_param.old_val = imperial_garden_score - add_value
        log_param.new_val = imperial_garden_score

        LogManager.log_game(log_param)


class RuinsOutSideScoreLog(object):
    """
    遗迹夺宝绑定积分日志
    """
    @staticmethod
    def log_game(log_param, ruins_outside_score, add_value, chest_type=None):
        """
        遗迹夺宝绑定积分
        :param log_param:
        :param ruins_outside_score: 遗迹夺宝绑定积分
        :param add_value: 获得的遗迹夺宝绑定积分
        :param chest_type: 宝箱类型（开宝箱才有）
        :return:
        """
        log_param.field_name = FieldName.RuinsOutSideScore
        log_param.old_val = ruins_outside_score - add_value
        log_param.new_val = ruins_outside_score

        reserve = log_param.reserve
        if chest_type:
            reserve['ChestType'] = chest_type
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class RuinsInSideScoreLog(object):
    """
    遗迹夺宝未绑定积分日志
    """
    @staticmethod
    def log_game(log_param, ruins_inside_score, add_value, chest_type=None, enemy_role_id=None):
        """
        遗迹夺宝未绑定积分
        :param log_param:
        :param ruins_inside_score: 遗迹夺宝未绑定积分
        :param add_value: 获得的遗迹夺宝绑定积分
        :param chest_type: 宝箱类型（开宝箱才有）
        :param enemy_role_id: 挑战/被挑战玩家id（挑战/被挑战玩家才有）
        :return:
        """
        log_param.field_name = FieldName.RuinsInSideScore
        log_param.old_val = ruins_inside_score - add_value
        log_param.new_val = ruins_inside_score

        reserve = log_param.reserve
        if chest_type:
            reserve['ChestType'] = chest_type
        if enemy_role_id:
            reserve['EnemyRoleId'] = enemy_role_id
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class CrossRuinsOutSideScoreLog(object):
    """
    跨服遗迹夺宝绑定积分日志
    """
    @staticmethod
    def log_game(log_param, ruins_outside_score, chest_type=None):
        """
        跨服遗迹夺宝绑定积分
        :param log_param:
        :param ruins_outside_score: 遗迹夺宝绑定积分
        :param chest_type: 宝箱类型（开宝箱才有）
        :return:
        """
        log_param.field_name = FieldName.CrossRuinsOutSideScore
        log_param.new_val = ruins_outside_score

        reserve = log_param.reserve
        if chest_type:
            reserve['ChestType'] = chest_type
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class CrossRuinsInSideScoreLog(object):
    """
    跨服遗迹夺宝未绑定积分日志
    """
    @staticmethod
    def log_game(log_param, ruins_inside_score, chest_type=None, enemy_nick_name=None):
        """
        跨服遗迹夺宝未绑定积分
        :param log_param:
        :param ruins_inside_score: 遗迹夺宝未绑定积分
        :param chest_type: 宝箱类型（开宝箱才有）
        :param enemy_nick_name: 挑战/被挑战玩家昵称（挑战/被挑战玩家才有）
        :return:
        """
        log_param.field_name = FieldName.CrossRuinsInSideScore
        log_param.new_val = ruins_inside_score

        reserve = log_param.reserve
        if chest_type:
            reserve['ChestType'] = chest_type
        if enemy_nick_name:
            reserve['EnemyNickName'] = enemy_nick_name
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class ReusableActivityScoreLog(object):
    """
    万能活动积分日志
    """
    @staticmethod
    def log_game(log_param, activity_id, reusable_activity_score, add_value,
                 item_type=None, item_id=None, item_num=None):
        """
        万能活动积分
        :param log_param:
        :param activity_id: 万能活动id
        :param reusable_activity_score: 万能活动积分
        :param add_value: 获得的万能活动积分
        :param item_type: 道具类型（商店兑换）
        :param item_id: 道具id（商店兑换）
        :param item_num: 道具数量（商店兑换）
        :return:
        """
        log_param.field_name = FieldName.ReusableActivityScore
        log_param.scene = activity_id
        log_param.old_val = reusable_activity_score - add_value
        log_param.new_val = reusable_activity_score

        reserve = log_param.reserve
        if item_type:
            reserve['ItemType'] = item_type
            reserve['ItemId'] = item_id
            reserve['Count'] = item_num
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class GemstoneLog(object):
    """
    宝石日志
    """
    @staticmethod
    def log_game(log_param, gemstone_num, add_value, item_type=None, item_id=None, item_num=None):
        """
        藩属国宝石
        :param log_param:
        :param gemstone_num: 藩属国宝石
        :param add_value: 获得的藩属国宝石
        :param item_type: 道具类型（宝石商店兑换）
        :param item_id: 道具id（宝石商店兑换）
        :param item_num: 道具数量（宝石商店兑换）
        :return:
        """
        log_param.field_name = FieldName.Gemstone
        log_param.old_val = gemstone_num - add_value
        log_param.new_val = gemstone_num

        reserve = log_param.reserve
        if item_type:
            reserve['ItemType'] = item_type
            reserve['ItemId'] = item_id
            reserve['Count'] = item_num
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class DinnerPointLog(object):
    """
    宴会积分日志
    """
    @staticmethod
    def log_game(log_param, dinner_point, add_value, award_list=None):
        """
        宴会积分
        :param log_param:
        :param dinner_point: 宴会积分
        :param add_value: 获得的宴会积分
        :param award_list: 道具列表（宴会商店兑换）
        :return:
        """
        log_param.field_name = FieldName.DinnerPoint
        log_param.old_val = dinner_point - add_value
        log_param.new_val = dinner_point

        reserve = log_param.reserve
        if award_list:
            reserve['AwardList'] = award_list
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class DinnerVisitorLog(object):
    """
    宴会来访日志
    """
    @staticmethod
    def log_game(log_param, dinner_point, add_value):
        """
        宴会来访记录
        :param log_param:
        :param dinner_point:
        :param add_value:
        :return:
        """
        log_param.field_name = FieldName.DinnerVisit
        log_param.old_val = dinner_point - add_value
        log_param.new_val = dinner_point
        LogManager.log_game(log_param)


class CrossSoccerPointLog(object):
    """
    跨服足球商城积分日志
    """
    @staticmethod
    def log_game(log_param, soccer_point, add_value, award_list=None, ext=None):
        """
        跨服足球商城积分
        :param log_param:
        :param soccer_point: 跨服足球商城积分
        :param add_value: 获得的跨服足球商城积分
        :param award_list: 道具列表（跨服足球商店兑换）
        :param ext: 拓展字段(NpcId：妃子id，TrainPlay：增加妃子属性值，TimeLeft：剩余时间，BloodLeft：剩余血量)
        :return:
        """
        log_param.field_name = FieldName.CrossSoccerPoint
        log_param.old_val = soccer_point - add_value
        log_param.new_val = soccer_point

        reserve = log_param.reserve
        if award_list:
            reserve['AwardList'] = award_list
        if ext:
            reserve['Ext'] = ext
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class DrillPointLog(object):
    """
    校场积分日志
    """
    @staticmethod
    def log_game(log_param, drill_point, old_value, fight_type,
                 def_rid=None, att_cfg_id=None, att_rid=None, def_cfg_id=None):
        """
        校场积分
        :param log_param:
        :param drill_point: 校场积分
        :param old_value: 获得的校场积分
        :param fight_type: 战斗类型
        :param def_rid: 守方rid
        :param att_cfg_id: 进攻大臣
        :param def_cfg_id: 守方大臣
        :param att_rid: 进攻rid(被攻击时记录)
        :return:
        """
        log_param.field_name = FieldName.DrillPoint
        log_param.old_val = old_value
        log_param.new_val = drill_point

        reserve = log_param.reserve
        reserve['FightType'] = fight_type
        if att_rid:
            reserve['AttRid'] = att_rid
        if def_rid:
            reserve['DefRid'] = def_rid
        if att_cfg_id:
            reserve['CfgId'] = att_cfg_id
        if def_cfg_id:
            reserve['DefCfgId'] = def_cfg_id
        log_param.reserve = reserve

        LogManager.log_game(log_param)

##########################
#   妃子相关
##########################


class FavorabilityLog(object):
    """
    妃子好感度日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, item_count, add_value=1):
        """
        记录妃子好感度
        :param log_param:
        :param cfg_id: 妃子id
        :param item_count: 当前好感度
        :param add_value: 增加的好感度
        :return:
        """
        log_param.field_name = FieldName.Favorability
        log_param.scene = cfg_id
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count

        LogManager.log_game(log_param)


class IntimateLog(object):
    """
    妃子亲密度日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, intimate, intimate_lv, item_type=None, item_id=None, item_num=None):
        """
        记录妃子亲密度
        :param log_param:
        :param cfg_id: 妃子id
        :param intimate: 当前亲密度
        :param intimate_lv: 当前亲密等级
        :param item_type: 道具类型（赏赐妃子）
        :param item_id: 道具id（赏赐妃子）
        :param item_num: 道具数量（赏赐妃子）
        :return:
        """
        log_param.field_name = FieldName.Intimate
        log_param.scene = cfg_id

        reserve = log_param.reserve
        reserve['Intimate'] = intimate
        reserve['IntimateLv'] = intimate_lv
        if item_type:
            reserve['ItemType'] = item_type
            reserve['ItemId'] = item_id
            reserve['ItemNum'] = item_num
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class ConcubineAttributeLog(object):
    """
    妃子属性日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, old_attribute, new_attribute, item_type=None, item_id=None, item_num=None):
        """
        记录妃子属性
        :param log_param:
        :param cfg_id: 妃子id
        :param old_attribute: 旧妃子属性列表
        :param new_attribute: 新妃子属性列表
        :param item_type: 道具类型（赏赐妃子）
        :param item_id: 道具id（赏赐妃子）
        :param item_num: 道具数量（赏赐妃子）
        :return:
        """
        reserve = log_param.reserve
        reserve['OldAttribute'] = old_attribute
        reserve['NewAttribute'] = new_attribute
        if item_type:
            reserve['ItemType'] = item_type
            reserve['ItemId'] = item_id
            reserve['ItemNum'] = item_num
        log_param.reserve = reserve

        log_param.field_name = FieldName.ConcubineAttribute
        log_param.scene = cfg_id
        LogManager.log_game(log_param)


class ForceLog(object):
    """
    妃子势力点日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, item_count, add_value):
        """
        记录妃子势力点
        :param log_param:
        :param cfg_id: 妃子id
        :param item_count: 当前势力点
        :param add_value: 增加的势力点
        :return:
        """
        log_param.field_name = FieldName.Force
        log_param.scene = cfg_id
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count

        LogManager.log_game(log_param)


class LuckConcubineLog(object):
    """
    妃子宠幸日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, item_count, add_value=1, cost=None):
        """
        记录妃子宠幸日志
        :param log_param:
        :param cfg_id: 妃子id
        :param item_count: 当前亲密等级
        :param add_value: 增加的亲密等级
        :param cost: 花费元宝
        :return:
        """
        reserve = log_param.reserve
        if cost:
            reserve['Cost'] = cost
            log_param.reserve = reserve

        log_param.field_name = FieldName.LuckConcubine
        log_param.scene = cfg_id
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count
        log_param.remark = '宠幸妃子'

        LogManager.log_game(log_param)


class UpdateConcubineTitleLog(object):
    """
    封妃日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, item_count, add_value=1):
        """
        记录封妃日志
        :param log_param:
        :param cfg_id: 妃子id
        :param item_count: 当前妃位等级
        :param add_value: 增加的妃位等级
        :return:
        """
        log_param.field_name = FieldName.UpdateConcubineTitle
        log_param.scene = cfg_id
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count
        log_param.remark = '升级妃位'

        LogManager.log_game(log_param)


class ConcubineTitleExpLog(object):
    """
    妃位经验日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, item_count, add_value=1):
        """
        记录妃位经验
        :param log_param:
        :param cfg_id: 妃子id
        :param item_count: 当前妃位经验
        :param add_value: 增加的妃位经验
        :return:
        """
        log_param.field_name = FieldName.ConcubineTitleExp
        log_param.scene = cfg_id
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count
        log_param.remark = '妃位经验涨幅'

        LogManager.log_game(log_param)


##########################
#   大臣相关
##########################
class UpdateMinisterLog(object):
    """
    大臣升级日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, old_val, new_val, cost):
        """
        大臣升级
        :param log_param:
        :param cfg_id: 大臣id
        :param old_val: 升级前等级
        :param new_val: 升级后等级
        :param cost: 花费的银两
        :return:
        """
        log_param.field_name = FieldName.UpdateMinister
        log_param.scene = cfg_id
        log_param.old_val = old_val
        log_param.new_val = new_val
        log_param.remark = '大臣升级'

        reserve = log_param.reserve
        reserve['Cost'] = cost
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class GrowMinisterLog(object):
    """
    大臣资质突破日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, item_count, add_value, grow_index, success_rate, grow_result):
        """
        大臣资质突破
        :param log_param:
        :param cfg_id: 大臣id
        :param item_count: 当前成长点
        :param add_value: 增加的成长点
        :param grow_index: 突破属性（ 0:商,1:农, 2:政, 3:军）
        :param success_rate: 当前突破成功率
        :param grow_result: 突破的结果(1:成功,0:失败)
        :return:
        """
        reserve = log_param.reserve
        reserve['GrowIndex'] = grow_index
        reserve['SuccessRate'] = success_rate
        reserve['Result'] = grow_result
        log_param.reserve = reserve

        log_param.field_name = FieldName.GrowMinister
        log_param.scene = cfg_id
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count

        LogManager.log_game(log_param)


class UpgradeMinisterGradeLog(object):
    """
    大臣封品日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, item_count, add_value=1):
        """
        大臣封品
        :param log_param:
        :param cfg_id: 大臣id
        :param item_count: 当前品级
        :param add_value: 增加的品级
        :return:
        """
        log_param.field_name = FieldName.UpgradeMinisterGrade
        log_param.scene = cfg_id
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count
        log_param.remark = '大臣封品'

        LogManager.log_game(log_param)


class UpgradeMinisterRankLog(object):
    """
    大臣封爵日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, rank, cost_list):
        """
        大臣封爵
        :param log_param:
        :param cfg_id: 大臣id
        :param rank: 当前爵位
        :param cost_list: 消耗道具列表
        :return:
        """
        log_param.field_name = FieldName.UpgradeMinisterRank
        log_param.scene = cfg_id
        log_param.remark = '大臣封爵'

        reserve = log_param.reserve
        reserve['Rank'] = rank
        reserve['CostList'] = cost_list
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class AptitudeLog(object):
    """
    大臣资质变更日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, add_value, grow_index):
        """
        大臣资质变更
        :param log_param:
        :param cfg_id: 大臣id
        :param add_value: 增加的资质
        :param grow_index: 突破的属性
        :return:
        """
        log_param.field_name = FieldName.Aptitude
        log_param.scene = cfg_id
        log_param.new_val = add_value

        reserve = log_param.reserve
        reserve['GrowIndex'] = grow_index
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class RewardTreasureLog(object):
    """
    大臣赏赐典籍日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, item_type, item_id, item_num):
        """
        大臣赏赐典籍
        :param log_param:
        :param cfg_id: 大臣id
        :param item_type: 道具类型
        :param item_id: 道具id
        :param item_num: 道具数量
        :return:
        """
        log_param.field_name = FieldName.RewardTreasure
        log_param.scene = cfg_id
        log_param.remark = '赏赐珍宝'

        reserve = log_param.reserve
        reserve['ItemType'] = item_type
        reserve['ItemId'] = item_id
        reserve['ItemNum'] = item_num
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class StrengthenMinisterLog(object):
    """
    强化大臣(清帝/女将)日志
    """
    @staticmethod
    def log_game(log_param, new_val, add_val, reserve):
        log_param.field_name = FieldName.StrengthenMinister
        log_param.old_val = new_val - add_val
        log_param.new_val = new_val
        log_param.reserve = reserve
        LogManager.log_game(log_param)


class BreakThroughMinisterLog(object):
    """
    突破大臣日志
    """
    @staticmethod
    def log_game(log_param, new_val, add_val, reserve):
        log_param.field_name = FieldName.BreakThroughMinister
        log_param.old_val = new_val - add_val
        log_param.new_val = new_val
        log_param.reserve = reserve
        LogManager.log_game(log_param)


##########################
#   校场相关
##########################
class DrillLog(object):
    """
    校场出使日志(校场出使、挑战玩家、复仇玩家)
    """
    @staticmethod
    def log_game(log_param, cfg_id, atk_win_time, def_rid, battle_type):
        """
        校场出使(校场出使、挑战玩家、复仇玩家、切磋)
        :param log_param:
        :param cfg_id: 大臣id
        :param atk_win_time: 击败大臣数量
        :param def_rid: 出使到的玩家rid
        :param battle_type: 战斗类型（校场出使、挑战玩家、复仇玩家、切磋）
        :return:
        """
        log_param.scene = cfg_id
        reserve = log_param.reserve
        reserve['CfgId'] = cfg_id
        reserve['AtkWinTime'] = atk_win_time
        reserve['DefRid'] = def_rid
        log_param.reserve = reserve

        from pyshare.const.enums.drill_field import BattleType
        if battle_type == BattleType.Drilling:
            log_param.field_name = FieldName.Drill
            log_param.remark = '校场出使'
        elif battle_type == BattleType.Challenge:
            log_param.field_name = FieldName.ChallengeDrill
            log_param.remark = '挑战玩家'
        elif battle_type == BattleType.Revenge:
            log_param.field_name = FieldName.ChallengeDrill
            log_param.remark = '复仇玩家'
        elif battle_type == BattleType.DrillingTrial:
            log_param.field_name = FieldName.Drill
            log_param.remark = '校场切磋'

        LogManager.log_game(log_param)


class DrillVisitLog(object):
    """
    校场来访日志
    """
    @staticmethod
    def log_game(log_param, atk_rid, cfg_id, aptitude, hp, battle_type, score, atk_win_time):
        """
        校场来访
        :param log_param:
        :param atk_rid: 进攻玩家id
        :param cfg_id: 进攻大臣id
        :param aptitude: 资质
        :param hp: 血量
        :param battle_type: 攻击类型
        :param score: 分数变更
        :param atk_win_time: 击败大臣数量
        :return:
        """
        log_param.field_name = FieldName.DrillVisit
        log_param.scene = '11707'
        reserve = log_param.reserve
        reserve['AtkRid'] = atk_rid
        reserve['CfgId'] = cfg_id
        reserve['Aptitude'] = aptitude
        reserve['Hp'] = hp
        reserve['Type'] = battle_type
        reserve['Score'] = score
        reserve['AtkWinTime'] = atk_win_time
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class ExploitPointLog(object):
    """
    功勋点日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, exploit, add_value):
        """
        功勋点变化
        :param log_param:
        :param cfg_id: 大臣id
        :param exploit: 功勋点
        :param add_value: 获得的功勋点
        :return:
        """
        log_param.field_name = FieldName.ExploitPoint
        log_param.scene = cfg_id
        log_param.old_val = exploit - add_value
        log_param.new_val = exploit

        LogManager.log_game(log_param)


class DrillNPCLog(object):
    """
    校场抓捕叛军日志
    """
    @staticmethod
    def log_game(log_param, hp, battle_type, atk_win_time, add_value):
        """
        校场抓捕叛军
        :param log_param:
        :param hp: 血量
        :param battle_type: 攻击类型
        :param atk_win_time: 击败大臣数量
        :param add_value: 增加击败大臣数量
        :return:
        """
        log_param.field_name = FieldName.DrillNPC
        reserve = log_param.reserve
        log_param.old_val = atk_win_time - add_value
        log_param.new_val = atk_win_time
        reserve['Hp'] = hp
        reserve['Type'] = battle_type
        reserve['AtkWinTime'] = atk_win_time
        log_param.reserve = reserve
        LogManager.log_game(log_param)


class DrillMoraleLog(object):
    """
    校场士气值日志
    """

    @staticmethod
    def log_game(log_param, change_value, new_value):
        """
        士气值变化
        :param log_param:
        :param change_value:
        :param new_value:
        :return:
        """
        log_param.field_name = FieldName.DrillMorale
        log_param.old_val = new_value - change_value
        log_param.new_val = new_value
        LogManager.log_game(log_param)


##########################
#   皇子相关
##########################
class TeachPrinceLog(object):
    """
    皇子培养日志
    """
    @staticmethod
    def log_game(log_param, prince_name, old_prince_lv, new_prince_lv, teach_type=TeachType.Normal):
        """
        关卡boss
        :param log_param:
        :param prince_name: 皇子昵称
        :param old_prince_lv: 培养前皇子等级
        :param new_prince_lv: 培养后皇子等级
        :param teach_type: 教导类型
        :return:
        """
        log_param.field_name = FieldName.TeachPrince
        if teach_type == TeachType.Normal:
            log_param.scene = '13205'
            log_param.remark = '培养皇子'
        elif teach_type == TeachType.OneKey:
            log_param.scene = '13209'
            log_param.remark = '一键培养皇子'
        else:
            log_param.scene = '13210'
            log_param.remark = '一键完成'

        reserve = log_param.reserve
        reserve['PrinceNickName'] = prince_name
        reserve['OldPrinceLv'] = old_prince_lv
        reserve['PrinceLv'] = new_prince_lv
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class ExtendSeatLog(object):
    """
    上书房开坑日志
    """
    @staticmethod
    def log_game(log_param, seat_num, cost, game_gold):
        """
        上书房扩建
        :param log_param:
        :param seat_num: 位置数
        :param cost: 花费元宝
        :param game_gold: 元宝剩余
        :return:
        """
        log_param.field_name = FieldName.ExtendSeat
        log_param.scene = '13208'
        log_param.remark = '上书房扩建'

        reserve = log_param.reserve
        reserve['SeatNum'] = seat_num
        reserve['Cost'] = cost
        reserve['GameGold'] = game_gold
        log_param.reserve = reserve

        LogManager.log_game(log_param)

##########################
#   联盟相关
##########################


class BuildAllianceLog(object):
    """
    联盟建设日志
    """
    @staticmethod
    def log_game(log_param, alliance_id, build_type, cost=None):
        """
        联盟建设
        :param log_param:
        :param alliance_id: 联盟id
        :param build_type: 建设类型
        :param cost: 消耗元宝（元宝建设才有）
        :return:
        """
        log_param.field_name = FieldName.BuildAlliance
        log_param.scene = alliance_id
        log_param.remark = '联盟建设'

        reserve = log_param.reserve
        reserve['BuildType'] = build_type
        if cost:
            reserve['Cost'] = cost
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class AllianceInOrOutLog(object):
    """
    联盟进出日志
    """
    @staticmethod
    def log_game(log_param, alliance_no, operation_type):
        """
        进出联盟
        :param log_param:
        :param alliance_no: 联盟编号
        :param operation_type: 操作类型
        :return:
        """
        log_param.field_name = FieldName.AllianceInOrOut
        log_param.scene = alliance_no
        if operation_type == OperationType.JoinAlliance:
            log_param.remark = '加入联盟'
        elif operation_type == OperationType.ExitAlliance:
            log_param.remark = '退出联盟'
        elif operation_type == OperationType.Dismiss:
            log_param.remark = '解散联盟'
        elif operation_type == OperationType.BanishMember:
            log_param.remark = '被驱逐出联盟'

        LogManager.log_game(log_param)


class AllianceExpLog(object):
    """
    联盟经验日志
    """
    @staticmethod
    def log_game(log_param, alliance_id, alliance_exp, add_exp, add_alliance_exp_type):
        """
        联盟经验
        :param log_param:
        :param alliance_id: 联盟id
        :param alliance_exp: 联盟经验
        :param add_exp: 增加的联盟经验
        :param add_alliance_exp_type: 增加方式
        :return:
        """
        log_param.field_name = FieldName.AllianceExp
        log_param.scene = alliance_id
        log_param.old_val = alliance_exp - add_exp
        log_param.new_val = alliance_exp

        from pyshare.const.enums.alliance import AddAllianceExpType
        if add_alliance_exp_type == AddAllianceExpType.AllianceBuild:
            log_param.remark = '联盟建设增加联盟经验'
        elif add_alliance_exp_type == AddAllianceExpType.UseItem:
            log_param.remark = '使用道具增加联盟经验'
        elif add_alliance_exp_type == AddAllianceExpType.AttackMystery:
            log_param.remark = '攻打联盟秘境增加联盟经验'
        elif add_alliance_exp_type == AddAllianceExpType.AllianceBattleReward:
            log_param.remark = '领取盟战奖励联盟经验'

        LogManager.log_game(log_param)


class AllianceExchangeLog(object):
    """
    联盟兑换日志
    """
    @staticmethod
    def log_game(log_param, alliance_id, award_list, donate):
        """
        联盟兑换
        :param log_param:
        :param alliance_id: 联盟id
        :param award_list: 兑换的道具
        :param donate: 剩余贡献
        :return:
        """
        log_param.field_name = FieldName.AllianceExchange
        log_param.scene = alliance_id
        log_param.remark = '联盟兑换'

        reserve = log_param.reserve
        reserve['AwardList'] = award_list
        reserve['Donate'] = donate
        log_param.reserve = reserve
        LogManager.log_game(log_param)


class DonateLog(object):
    """
    联盟贡献变更日志
    """
    @staticmethod
    def log_game(log_param, alliance_id, donate, add_value, award_list=None, build_type=None):
        """
        联盟贡献变更
        :param log_param:
        :param alliance_id: 联盟id
        :param donate: 当前贡献
        :param add_value: 获得贡献
        :param award_list: 兑换的道具(兑换才有)
        :param build_type: 建设类型(联盟建设才有)
        :return:
        """
        log_param.field_name = FieldName.Donate
        log_param.scene = alliance_id
        log_param.old_val = donate - add_value
        log_param.new_val = donate

        reserve = log_param.reserve
        if award_list:
            reserve['AwardList'] = award_list
        if build_type:
            reserve['BuildType'] = build_type
        log_param.reserve = reserve
        LogManager.log_game(log_param)


class AllianceBattleFightScoreLog(object):
    """
    联盟海战记录
    """
    @staticmethod
    def log_game(log_param, add_value, battle_type='', enemy_id=None, activity_id=None):
        """
        :param log_param:
        :param add_value: 增加的积分
        :param battle_type: 海战类型：北线、南线、主海域
        :param enemy_id: 对方联盟id
        :param activity_id: 活动id
        :return:
        """
        log_param.field_name = FieldName.AllianceBattleFight
        log_param.scene = activity_id
        if battle_type:
            log_param.remark = '联盟{}海战'.format(battle_type)
        else:
            log_param.remark = '联盟海战'
        reserve = log_param.reserve
        reserve['Enemy'] = enemy_id
        reserve['Score'] = add_value
        reserve['Type'] = battle_type
        LogManager.log_game(log_param)



##########################
#   寻访相关
##########################
class TravelMotorcadeLog(object):
    """
    寻访车队日志
    """
    @staticmethod
    def log_game(log_param, cost):
        """
        寻访车队日志
        :param log_param:
        :param cost: 消耗元宝
        :return:
        """
        log_param.field_name = FieldName.TravelMotorcade
        log_param.scene = '11403'
        log_param.remark = '寻访车队事件消耗元宝'

        reserve = log_param.reserve
        reserve['Cost'] = cost
        log_param.reserve = reserve
        LogManager.log_game(log_param)


class TravelResourcesLog(object):
    """
    寻访资源日志（整合了寻访获得的所有资源道具）
    """
    @staticmethod
    def log_game(log_param, award_list, cost=None):
        """
        寻访资源日志
        :param log_param:
        :param award_list: 获得道具
        :param cost: 消耗元宝
        :return:
        """
        log_param.field_name = FieldName.TravelResources

        reserve = log_param.reserve
        reserve['AwardList'] = award_list
        if cost:
            reserve['Cost'] = cost
        log_param.reserve = reserve
        LogManager.log_game(log_param)

##########################
#   藩属国相关
##########################


class GirlLog(object):
    """
    获得侍女日志
    """
    @staticmethod
    def log_game(log_param, girl_data):
        """
        获得侍女
        :param log_param:
        :param girl_data: 侍女数据
        :return:
        """
        log_param.field_name = FieldName.Girl
        log_param.new_val = 1
        log_param.scene = '14502'
        log_param.remark = '纳贡'

        reserve = log_param.reserve
        reserve['GirlData'] = girl_data
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class TeachGirlLog(object):
    """
    调教侍女日志
    """
    @staticmethod
    def log_game(log_param):
        """
        获得侍女
        :param log_param:
        :return:
        """
        log_param.field_name = FieldName.TeachGirl
        log_param.new_val = 1
        log_param.scene = '14503'
        log_param.remark = '调教侍女'

        LogManager.log_game(log_param)


class DungeonBossLog(object):
    """
    关卡boss日志
    """
    @staticmethod
    def log_game(log_param, cfg_id, boss_hp):
        """
        关卡boss
        :param log_param:
        :param cfg_id: 大臣id
        :param boss_hp: boss血量
        :return:
        """
        log_param.field_name = FieldName.DungeonBoss
        log_param.scene = '11304'
        log_param.remark = '攻击关卡BOSS'

        reserve = log_param.reserve
        reserve['CfgId'] = cfg_id
        reserve['BossHp'] = boss_hp
        log_param.reserve = reserve

        LogManager.log_game(log_param)


class AchievementLog(object):
    """
    成就日志
    """
    @staticmethod
    def log_game(log_param, award_list, achievement_id):
        """
        成就日志
        :param log_param:
        :param award_list: 成就奖励
        :param achievement_id: 成就id
        :return:
        """
        log_param.field_name = FieldName.Achievement
        log_param.scene = '11904'
        log_param.remark = '领取成就奖励'

        reserve = log_param.reserve
        reserve['AwardList'] = award_list
        reserve['AchievementId'] = achievement_id
        log_param.reserve = reserve
        LogManager.log_game(log_param)


class CrossSiegeCityExpLog(object):
    """
    跨服攻城战城池经验日志
    """
    @staticmethod
    def log_game(log_param, new_val, add_value):
        """
        跨服攻城战城池经验
        :param log_param:
        :param new_val: 建设后经验
        :param add_value: 建设增加的经验
        :return:
        """
        log_param.field_name = FieldName.CrossSiegeCityExp
        log_param.scene = '15752'
        log_param.remark = '跨服攻城建设城池'
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossSiegeScoreLog(object):
    """
    跨服攻城战个人积分日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark):
        """
        跨服攻城战个人积分日志
        :param rid:
        :param new_val: 涨幅后的积分
        :param add_value: 涨幅
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossSiegeScore
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossChessScoreLog(object):
    """
    跨服棋局个人积分日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, scene):
        """
        跨服棋局个人积分
        :param rid:
        :param new_val: 涨幅后的积分
        :param add_value: 涨幅
        :param scene: 接口场景
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossChessScore
        log_param.scene = scene
        log_param.remark = VarLogRemarkDict.get(str(scene), '获取') + '跨服棋局积分'
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossChessManualLog(object):
    """
    跨服棋局个人棋谱日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, scene, server_id=None):
        """
        跨服棋局个人棋谱
        :param rid:
        :param new_val: 涨幅后的积分
        :param add_value: 涨幅
        :param scene: 接口场景
        :param server_id: 区服ID
        :return:
        """
        log_param = LogParam(rid=rid, server_id=server_id)
        log_param.field_name = FieldName.CrossChessManual
        log_param.scene = scene
        log_param.remark = VarLogRemarkDict.get(str(scene), '获取') + '跨服棋局棋谱' if add_value > 0 else '被玩家击杀'
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossChessFloorLog(object):
    """
    跨服棋局个人楼层变化
    """
    @staticmethod
    def log_game(rid, new_val, old_value, scene, remark, enemy_rid=None, server_id=None):
        """
        跨服棋局个人棋谱
        :param rid:
        :param new_val:
        :param old_value:
        :param scene: 接口场景
        :param remark: 说明
        :param enemy_rid: 敌方rid
        :param server_id: 区服ID
        :return:
        """
        log_param = LogParam(rid=rid, server_id=server_id)
        log_param.field_name = FieldName.CrossChessFloor
        log_param.scene = scene
        log_param.remark = remark
        log_param.old_val = old_value
        log_param.new_val = new_val
        if enemy_rid:
            log_param.reserve = {'EnemyRid': enemy_rid}
        LogManager.log_game(log_param)


class CrossChessRoleVitLog(object):
    """
    跨服棋局角色体力日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, scene, remark):
        """
        :param rid:
        :param new_val: 涨幅后的体力值
        :param add_value: 涨幅
        :param scene: action_id
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossChessRoleVit
        log_param.scene = scene
        log_param.remark = remark
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossChessRolePassCardNumLog(object):
    """
    跨服棋局角色心境值日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value):
        """
        :param rid:
        :param new_val: 涨幅后的心境值
        :param add_value: 涨幅
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossChessPassCardNum
        log_param.scene = get_action_id()
        log_param.remark = CrossChessPassCardNumLogDict.get(str(log_param.scene), '获取备注失败')
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossRehearseScoreLog(object):
    """
    跨服健锐演兵个人积分日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value):
        """
        跨服健锐演兵个人积分日志
        :param rid:
        :param new_val: 涨幅后的积分
        :param add_value: 涨幅
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossRehearseScore
        log_param.scene = get_action_id()
        log_param.remark = '跨服健锐演兵积分'
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossRehearseHpLog(object):
    """
    跨服健锐演兵生命值日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark):
        """
        :param rid:
        :param new_val: 涨幅后的生命值
        :param add_value: 涨幅
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossRehearseHp
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossRehearseVitLog(object):
    """
    跨服健锐演兵体力值日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark):
        """
        :param rid:
        :param new_val: 涨幅后的体力值
        :param add_value: 涨幅
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossRehearseVit
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossNaadamPrestigeLog(object):
    """
    跨服那达慕声望日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value):
        """
        :param rid:
        :param new_val: 涨幅后的声望值
        :param add_value: 涨幅
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossNaadamPrestige
        log_param.scene = get_action_id()
        log_param.remark = RolePrestigeCrossNadamLogDict.get(str(log_param.scene), '获取备注失败')
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossNaadamRoleVitLog(object):
    """
    跨服那达慕角色体力日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value):
        """
        :param rid:
        :param new_val: 涨幅后的体力值
        :param add_value: 涨幅
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossNaadamRoleVit
        log_param.scene = get_action_id()
        log_param.remark = RoleVitCrossNadamLogDict.get(str(log_param.scene), '获取备注失败')
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossNaadamLotteryResultLog(object):
    """
    跨服那达慕哈达抽奖结果日志
    """
    @staticmethod
    def log_game(rid, lottery_count, loop_num, grid_num, all_move_count, remark):
        """
        :param rid:
        :param lottery_count: 抽奖次数（单抽，十连抽）
        :param loop_num: 圈数
        :param grid_num: 格子数
        :param all_move_count: 移动总步数
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossNaadamLotteryResult
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.reserve = {"LotteryCount": lottery_count,
                             "LoopNum": loop_num, "GridNum": grid_num, "AllMoveCount": all_move_count}
        LogManager.log_game(log_param)


class CrossNaadamAssistLog(object):
    """
    跨服那达慕协助日志
    """
    @staticmethod
    def log_game(rid, assist_minister_cfg_id, assist_rid):
        """
        :param rid: 被协助者rid
        :param assist_minister_cfg_id: 协助的大臣id
        :param assist_rid: 协助者rid
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossNaadamAssist
        log_param.scene = get_action_id()
        log_param.remark = "协助信息"
        log_param.reserve = {"AssistMinisterCfgId": assist_minister_cfg_id, "AssistRid": assist_rid}
        LogManager.log_game(log_param)


class CrossNaadamSearchResultLog(object):
    """
    跨服那达慕搜索日志
    """
    @staticmethod
    def log_game(rid, affair_type, cfg_id):
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossNaadamSearchResult
        log_param.scene = get_action_id()
        log_param.remark = "搜索结果"
        log_param.reserve = {"AffairType": affair_type, "CfgId": cfg_id}
        LogManager.log_game(log_param)


class CrossNaadamRoleScoreLog(object):
    """
    跨服那达慕个人积分变动日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value):
        """
        :param rid:
        :param new_val: 涨幅后的积分
        :param add_value: 涨幅
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossNaadamScore
        log_param.scene = get_action_id()
        log_param.remark = RoleScoreCrossNadamLogDict.get(str(log_param.scene), '获取备注失败')
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossNaadamHadaValueLog(object):
    """
    跨服那达慕个人哈达变动日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value):
        """
        :param rid:
        :param new_val: 涨幅后的积分
        :param add_value: 涨幅
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossNaadamHadaValue
        log_param.scene = get_action_id()
        log_param.remark = HadaCrossNadamLogDict.get(str(log_param.scene), '获取备注失败')
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossNaadamBossSecretKillerLog(object):
    """
    Boss和秘境击杀者日志
    """
    @staticmethod
    def log_game(rid, server_id, minister_id, alliance_id, remark):
        """
        :param rid:
        :param server_id: 区服id
        :param minister_id: 击杀者大臣id
        :param alliance_id 联盟id
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossNaadamBossSecretKiller
        log_param.remark = remark
        log_param.scene = get_action_id()
        log_param.server_id = server_id
        log_param.reserve = {"MinisterCfgId": minister_id, "AllianceId": alliance_id}
        LogManager.log_game(log_param)


class CostumeShopLog(object):
    """
    凌烟阁日志
    """
    @staticmethod
    def log_game(rid, new_val, old_val, remark, reserve, server_id):
        """
        凌烟阁刷新
        :param rid:
        :param new_val: 更新后时间
        :param old_val: 更新前时间
        :param remark: 备注
        :param reserve: 备注
        :param server_id: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CostumeShopRefresh
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.old_val = old_val
        log_param.new_val = new_val
        log_param.reserve = reserve
        log_param.server_id = server_id
        LogManager.log_game(log_param)


class BanquetScoreLog(object):
    """
    满汉全席个人积分日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark, reserve):
        """
        满汉全席个人积分日志
        :param rid:
        :param new_val: 涨幅后的积分
        :param add_value: 涨幅
        :param remark: 备注
        :param reserve: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.BanquetScore
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.reserve = reserve
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class BanquetVitLog(object):
    """
    满汉全席体力值日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark):
        """
        :param rid:
        :param new_val: 涨幅后的体力值
        :param add_value: 涨幅
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.BanquetVit
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class BanquetSpecialFoodLog(object):
    """
    满汉全席特殊食材日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark, reserve):
        """
        :param rid:
        :param new_val: 涨幅后的体力值
        :param add_value: 涨幅
        :param remark: 备注
        :param reserve: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.BanquetSpecialFood
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.reserve = reserve
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class BanquetPondLog(object):
    """
    满汉全席锅底日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark, reserve):
        """
        :param rid:
        :param new_val: 涨幅后的体力值
        :param add_value: 涨幅
        :param remark: 备注
        :param reserve: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.BanquetPond
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.reserve = reserve
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class BanquetLotteryLog(object):
    """
    满汉全席抽奖日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark, reserve):
        """
        :param rid:
        :param new_val: 涨幅后的体力值
        :param add_value: 涨幅
        :param remark: 备注
        :param reserve: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.BanquetLottery
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.reserve = reserve
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class BanquetGoldScoopLog(object):
    """
    满汉全席金勺日志
    """
    @staticmethod
    def log_game(rid, old_val, add_value, remark, reserve):
        """
        :param rid:
        :param old_val: 增加前的金勺个数
        :param add_value: 涨幅
        :param remark: 备注
        :param reserve: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.BanquetGoldScoop
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.reserve = reserve
        log_param.old_val = old_val
        log_param.new_val = old_val + add_value
        LogManager.log_game(log_param)


class FundPurchaseLog(object):
    """
    国力基金购买日志
    """
    @staticmethod
    def log_game(old_val, add_value, log_param, filed_name=FieldName.PowerFundPurchase):
        """
        :param old_val: 增加元宝
        :param add_value: 涨幅
        :param log_param: 备注
        :param filed_name: 日志分类
        :return:
        """

        log_param.field_name = filed_name
        log_param.scene = get_action_id()
        log_param.old_val = old_val
        log_param.new_val = old_val + add_value
        LogManager.log_game(log_param)


class GameEventLog(object):
    """
    事件日志
    """
    @staticmethod
    def log_game(log_param):
        """
        :param log_param:
        :return:
        """
        LogManager.log_game_event(log_param)


class GameRankLog(object):
    """
    排行榜日志
    """
    @staticmethod
    def log_game(log_param):
        """
        :param log_param:
        :return:
        """
        LogManager.log_game_rank(log_param)


class GameRoleLog(object):
    """
    角色属性日志
    """
    @staticmethod
    def log_game(log_param):
        """
        :param log_param:
        :return:
        """
        LogManager.log_role_property(log_param)


class VipMisoperationLog(object):
    """
    vip误操作回退日志
    """
    @staticmethod
    def log_game(rid, filed_name, remark, reserve):
        """
        :param rid:
        :param filed_name: 资源日志分类
        :param remark: 备注
        :param reserve: 扩展字段
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = filed_name
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.reserve = reserve
        LogManager.log_game(log_param)


class QuestionnaireLog(object):
    """
    调查问卷答案提交日志
    """
    @staticmethod
    def log_game(rid, scene, reserve, remark):
        """
        :param rid:
        :param scene: 问卷id
        :param reserve: 问卷答案
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.QuestionnaireAnswer
        log_param.scene = scene
        log_param.reserve = reserve
        log_param.remark = remark
        LogManager.log_game(log_param)


class CrossBanquetVitLog(object):
    """
    跨服满汉全席体力值日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark):
        """
        :param rid:
        :param new_val: 涨幅后的体力值
        :param add_value: 涨幅
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossBanquetVit
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossBanquetGoldScoopLog(object):
    """
    跨服满汉全席金勺日志
    """
    @staticmethod
    def log_game(rid, old_val, add_value, remark, reserve):
        """
        :param rid:
        :param old_val: 增加前的金勺个数
        :param add_value: 涨幅
        :param remark: 备注
        :param reserve: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossBanquetGoldScoop
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.reserve = reserve
        log_param.old_val = old_val
        log_param.new_val = old_val + add_value
        LogManager.log_game(log_param)


class CrossSeasonScoreLog(object):
    """
    赛季积分日志
    """
    @staticmethod
    def log_game(new_val, add_value, log_param):
        """
        赛季积分日志
        :param new_val: 涨幅后的积分
        :param add_value: 涨幅
        :param log_param: 备注
        :return:
        """
        log_param.field_name = FieldName.CrossSeasonScore
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossSeasonDanExpLog(object):
    """
    赛季段位经验日志
    """
    @staticmethod
    def log_game(new_val, add_value, log_param):
        """
        赛季段位经验日志
        :param new_val: 涨幅后的经验
        :param add_value: 涨幅
        :param log_param: 备注
        :return:
        """
        log_param.field_name = FieldName.CrossSeasonDanExp
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossSeasonPageantCountLog(object):
    """
    跨服赛季举办次数
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark):
        """
        :param rid:
        :param new_val: 涨幅后的次数
        :param add_value: 涨幅
        :param remark: 备注
        :return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossSeasonPageantCount
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class PuzzleFragmentLog(object):
    """
    拼图碎片日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, puzzle_id, fragment_id, remark):
        """
        @param rid:
        @param new_val:
        @param add_value:
        @param puzzle_id: 拼图id
        @param fragment_id: 碎片id
        @param remark:
        @return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.PuzzleFragment
        log_param.scene = str(puzzle_id) + ":" + str(fragment_id)
        log_param.remark = remark
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class PuzzleScoreLog(object):
    """
    拼图积分日志
    """
    @staticmethod
    def log_game(rid, new_val, add_value, remark):
        """
        @param rid:
        @param new_val:
        @param add_value:
        @param remark:
        @return:
        """
        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.PuzzleScore
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.old_val = new_val - add_value
        log_param.new_val = new_val
        LogManager.log_game(log_param)


class CrossParagonLog(object):
    """
    贤才冲榜日志
    """
    @staticmethod
    def log_game(rid, old_val, add_value, remark='', reserve=None):
        """
        :param rid:
        :param old_val: 增加前贤才值
        :param add_value: 贤才值涨幅
        :param remark: 备注
        :param reserve: 扩展信息
        :return:
        """
        if not reserve:
            reserve = dict()

        log_param = LogParam(rid=rid)
        log_param.field_name = FieldName.CrossParagonScore
        log_param.scene = get_action_id()
        log_param.remark = remark
        log_param.reserve = reserve
        log_param.old_val = old_val
        log_param.new_val = old_val + add_value
        LogManager.log_game(log_param)


class ShowForeverLog(object):
    """
    永久外显道具日志
    """
    @staticmethod
    def log_game(log_param, item_type, item_id, item_count, add_value):
        """
        :param log_param:
        :param item_type: 物品类型
        :param item_id: 物品id
        :param item_count: 当前物品数量
        :param add_value: 物品增量
        :return:
        """
        log_param.field_name = FieldName.ShowForever
        log_param.scene = str(item_type) + ':' + str(item_id)
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count
        LogManager.log_game(log_param)


class ShowTimeLimitLog(object):
    """
    限时外显道具日志
    """
    @staticmethod
    def log_game(log_param, item_type, item_id, item_count, add_value, is_forever, expire_time):
        """
        :param log_param:
        :param item_type: 物品类型
        :param item_id: 物品id
        :param item_count: 当前物品数量
        :param add_value: 物品增量
        :param is_forever: 是否永久获得
        :param expire_time: 过期时间
        :return:
        """
        log_param.field_name = FieldName.ShowTimeLimit
        log_param.scene = str(item_type) + ':' + str(item_id)
        log_param.old_val = item_count - add_value
        log_param.new_val = item_count
        log_param.reserve['IsForever'] = is_forever
        log_param.reserve['ExpireTime'] = expire_time
        LogManager.log_game(log_param)

